package org.wlw.web.dao.impl;

import org.apache.ibatis.session.SqlSession;
import org.wlw.web.dao.IUserDao;
import org.wlw.web.mapper.UserMapper;
import org.wlw.web.models.User;
import org.wlw.web.utils.DBUtils;

public class UserDao extends BaseDao<User, UserMapper> implements IUserDao {

    @Override
    public User loadByUsername(String username) {
        SqlSession sqlSession = null;
        try {
            sqlSession = DBUtils.openSession();
            return (User)sqlSession.getMapper(UserMapper.class).loadByUsername(username);
        } finally {
            DBUtils.close(sqlSession);
        }
    }
}
